package org.misty.redis.web.config;

import lombok.Setter;
import org.misty.redis.client.JedisPoolAdapter;
import org.misty.redis.locker.LockerConfig;
import org.misty.redis.locker.RedisLocker;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Misty on 2020-06-01
 */
@Configuration
@ConfigurationProperties("redis.locker")
public class LockerConfigurer {
    @Setter
    private LockerConfig user;

    @Bean
    public RedisLocker redisLocker(JedisPoolAdapter client) {
        return new RedisLocker(client, user);
    }
}
